# Maintainer:
pkgname=krita-plugin-gmic
# match version to gmic.
pkgver=3.2.4.1
pkgrel=3
pkgdesc="Krita plugin for GMIC"
url="https://github.com/amyspark/gmic"
# krita
arch="all !s390x !armhf !armv7 !riscv64"
license="CECILL-2.1"
depends="gmic"
makedepends="
	bash
	cmake
	extra-cmake-modules
	fftw-dev
	kcoreaddons5-dev
	krita-dev
	gmic-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	samurai
	zstd
	"
source="https://github.com/amyspark/gmic/releases/download/v$pkgver/gmic-$pkgver-patched.tar.zst
	gmic-sys.patch
	no-qt6.patch
	"
builddir="$srcdir/gmic-$pkgver-patched"
options="!check" # no tests

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja -S gmic-qt \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DGMIC_QT_HOST=krita-plugin \
		-DQT_MAJOR_VERSION=5
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	# comes from gmic
	rm -fv "$pkgdir"/usr/share/gmic/gmic_cluts.gmz
}

sha512sums="
36de14ac7823e94e1988ada4e095ba18408bb9e7ab98f745573fcf759d0835e8182d887aa2c26e980a7974f5c2bdef44227c0cc6b9155849b7aafa49c6821c4c  gmic-3.2.4.1-patched.tar.zst
673c3644dbb55621204975b97346d8bbe4fd4860344dcbde849f84da6b343a412405944bf40d3eb215335127b9fb173b615b67a85a0b5bc36084e9bdcdcd42b4  gmic-sys.patch
34a605e417fed6233fb8f64108c56398cc2daa1b7bbbb847c1763c97100d1afc5a11929931b61f7fd67de10f215c87992a0e3ab1a8a86a3a9ceeac702e836230  no-qt6.patch
"
